<template>
  <div>
    <div style="text-align:center">{{comment.reply_count}}条回复</div>
    <comment-item :comment="comment"></comment-item>
    <van-cell>全部回复</van-cell>
    <comment-list @totalCount="totalCount" type="c" :artId="comment.com_id" :list="newObjComment"></comment-list>


    <!-- 发表评论组件 -->
    <div style="text-align:center;width:100%;" @click='isPostShow=true'>写评论</div>
    <!-- <post @shouClose="shouClose" :artId="comment.com_id" ></post> -->

      <!-- 发布评论 -->
    <van-popup v-model="isPostShow" position="bottom">
     <post @shouClose="shouClose" :artId="comment.com_id" ></post>
    </van-popup>
    <!-- /发布评论 -->
  </div>
</template>
           
<script>
import commentItem from '@/components/comment-item'
import commentList from '@/components/comment-list'


import post from '@/components/post'

export default {
  components: {
    commentItem,
    commentList,
    post
  },
  props: {
    comment: {
      type: [String, Object, Array],
      required: true
    }
  },
  data() {
    return {
      newObjComment: [],
      count: 0,
      isPostShow:false
    }
  },

  methods: {
    //  将评论的没每一项的条数接收
    totalCount(count) {
      // console.log(count, 5555)
      // this.count = count
    },

    shouClose(message){
      console.log(message,8899);
      this.newObjComment.unshift(message)
      this.isPostShow=false

      //评论条数自增
      this.comment.reply_count++
    }
  }
}
</script>
<style scoped>
</style>